<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<style type="text/css">
			#div1{
				display: flex;
				justify-content: center;
			}
			#div2{
				text-align: center;
			}
			#div3{
				text-align: center;
			}
		</style>
	</head>
	<body>
		<div id="div3">
			<select id="sel">
				<option value="">请选择大小</option>
				<option value="大" >大</option>
				<option value="小" >小</option>
			</select>
		</div>
		<div id="div1">
			<div id="" style="width: 115px;height: 105px;">
				<img src="img/1.jpg" id="img_src">
			</div>
			<br />
		</div>
		<div id="div2">
			<button type="button" onclick="img_bh(event)">开始</button>
		</div>
		
	</body>
	<script type="text/javascript">
		function img_bh(event){
			var img_src = document.getElementById('img_src');
			var over = 0;
			var xz = document.getElementById('sel').value;
			if(xz == ""){
				alert('请选择大小')
			}else{
				event.target.innerText = '游戏中...';
				var set = setInterval(function(){
					var num = sj();
					img_src.src = "img/"+num+".jpg";
					over++;
					
					if(over>=50){
						clearInterval(set);
						event.target.innerText = '开始';
							setTimeout(function(){
								if(num<4){
									var jg = '小'
									if(jg == xz){
										alert('你选择小，结果是小，恭喜你选对了，未来赌神就是你')
									}else{
										alert('你选择大，结果是小，选错了，傻子，周润发都救不了你')
									}
								}else if(num>=4){
									var jg = '大'
									if(jg == xz){
										alert('你选择大，结果是大，恭喜你选对了，未来赌神就是你')
									}else{
										alert('你选择小，结果是大，选错了，傻子，周润发都救不了你')
									}
								}
							},50)
					}
				},100)
			}
		}
		function sj(){
			var Num = 0;
			while(true){
				Num = Math.floor(Math.random()*10);
					if(Num!=0 && Num<7){
						break;
						}
					}			
			return Num;
		}
	</script>
</html>
